/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.lvyh.lightframe.cloud.authclient.config;

import java.util.ArrayList;
import java.util.List;

/**
 * 配置不需要认证url
 *
 * @author lvyh 2021/09/23.
 */
public class AuthorizeIgnoreUrlsConfig {

    private static final String[] ENDPOINTS = {
            "/oauth/**",
            "/actuator/**",
            "/*/v2/api-docs",
            "/swagger/api-docs",
            "/swagger-ui.html",
            "/doc.html",
            "/swagger-resources/**",
            "/webjars/**",
            "/druid/**",
            "/api-uaa/oauth/**",
            "/api-uaa/validate-code/**",
            "/api-uaa/validate-sms-code/**",
            "/api-user/menus/current",
            "/api-user/users/current",
            "/api-user/menus/findAlls",

            "/api-uaa/css/**",
            "/api-uaa/images/**",
            "/api-uaa/js/**",
            "/login.html",
            "/user/login",
            "/api-uaa/tokens/key"
    };

    public static List<String> ignoreUrls() {
        List<String> list = new ArrayList<>();
        for (String url : ENDPOINTS) {
            list.add(url);
        }
        return list;
    }

    public static String[] getUrls() {
        List<String> list = new ArrayList<>();
        for (String url : ENDPOINTS) {
            list.add(url);
        }
        return list.toArray(new String[list.size()]);
    }

}
